package com.headerfooter.songhang.library;

import ohos.agp.components.BaseItemProvider;
import ohos.agp.components.Component;
import ohos.agp.components.ComponentContainer;

/**
 * Created by songhang on 16/3/1.
 */
public class RecyclerViewAdapterWrapper extends BaseItemProvider {
    /**
     * BaseItemProvider对象
     */
    protected final BaseItemProvider wrapped;

    /**
     * 构造方法
     *
     * @param wrapped provider参数
     */
    public RecyclerViewAdapterWrapper(BaseItemProvider wrapped) {
        this.wrapped = wrapped;
    }

    @Override
    public int getCount() {
        return wrapped.getCount();
    }

    @Override
    public Object getItem(int position) {
        return wrapped.getItem(position);
    }

    @Override
    public long getItemId(int position) {
        return wrapped.getItemId(position);
    }

    @Override
    public int getItemComponentType(int position) {
        return wrapped.getItemComponentType(position);
    }

    @Override
    public Component getComponent(int index, Component component, ComponentContainer componentContainer) {
        return wrapped.getComponent(index, component, componentContainer);
    }

    /**
     * 获取provider
     *
     * @return BaseItemProvider
     */
    public BaseItemProvider getWrappedAdapter() {
        return wrapped;
    }
}

